#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
const int MAXN=1e5+7;
vector<int> G[MAXN];
typedef long long LL;
LL ji[MAXN], ou[MAXN];
LL resji[MAXN], resou[MAXN];
void DFS(int a) {
    int len=G[a].size();
    if (len==0) {
        ji[a]=0;
        ou[a]=0;
        return ;
    }
    for (int i=0; i<len; ++i) {
        DFS(G[a][i]);
    }
    LL o=0,j=0;
    for (int i=0; i<len; ++i) {
        resou[a]+=ji[G[a][i]]*o+ou[G[a][i]]*j+ji[G[a][i]]+j;
        resji[a]+=ou[G[a][i]]*o+1+ji[G[a][i]]*j+ou[G[a][i]]+o;
        o+=ji[G[a][i]];
        j+=ou[G[a][i]]+1;
    }
    ji[a]=j; ou[a]=o;
}
int main() {
    int n;
    cin>>n;
    memset(ji, 0, sizeof(ji));
    memset(ou, 0, sizeof(ou));
    int x,y;
    for (int i=0; i<n-1; ++i) {
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
    }
    DFS(1);
    /*for (int i=1; i<=n; ++i) {
        printf("%lld %lld\n", ji[i], ou[i]);
    }*/
    LL ans=0;
    for (int i=0; i<n; ++i) ans+=resou[i+1];
    printf("%lld\n", ans);
    return 0;
}
